﻿using System;
using System.Web;
using Malu.Entity;


namespace MaLu.Common
{
    [AjaxPro.AjaxNamespace("JiaDing.Platform")]
    public class AjaxMethod
    {
        public AjaxMethod()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        [AjaxPro.AjaxMethod]
        public AjaxProResult ClearSession(string key)
        {
            AjaxProResult result = new AjaxProResult();
            try
            {
                HttpContext context = HttpContext.Current;
                context.Session[key] = null;
                return new AjaxProResult(1, 0, "");
            }
            catch (Exception exc)
            {
                return new AjaxProResult(-1, -1, exc.Message);
            }
        }
        [AjaxPro.AjaxMethod]
        public AjaxProResult SetSession(string key, string val)
        {
            AjaxProResult result = new AjaxProResult();
            try
            {
                HttpContext context = HttpContext.Current;
                context.Session[key] = val;
                return new AjaxProResult(1, 0, "");
            }
            catch (Exception exc)
            {
                return new AjaxProResult(-1, -1, exc.Message);
            }
        }

       
    }
}